document.write(''); var embed = document.getElementById('rtvTourEmbed_642966'); var currentHeight = embed.offsetHeight; var newHeight = currentHeight; var parentHeight = null; var loopContinue = 1; var lastNode = embed; while(loopContinue === 1) { currentNode = lastNode.parentNode; parentHeight = currentNode.offsetHeight; if(currentNode.previousElementSibling !== null && (currentNode.previousElementSibling.style.display === 'inline-block' || currentNode.previousElementSibling.style.float) && currentNode.previousElementSibling.offsetHeight > currentHeight) { newHeight = currentNode.previousElementSibling.offsetHeight; loopContinue = 0; } else if(currentNode.nextElementSibling !== null && (currentNode.nextElementSibling.style.display === 'inline-block' || currentNode.nextElementSibling.style.float) && currentNode.nextElementSibling.offsetHeight > currentHeight) { newHeight = currentNode.nextElementSibling.offsetHeight; loopContinue = 0; } else if(parentHeight >= currentHeight) { loopContinue = 0; newHeight = parentHeight; } else if(currentNode.tagName === 'BODY') { newHeight = window.innerHeight; loopContinue = 0; } lastNode = currentNode; if(loopContinue === 0) { break; } } newHeight = 100 / 100 * newHeight; var currentWidth = embed.offsetWidth; var minHeight = currentWidth / 16 * 9; if(newHeight < minHeight) { newHeight = minHeight; } embed.style.height = newHeight + 'px';